"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebUtil = void 0;
class WebUtil {
    static getIpByExpressReq(req) {
        // Logger.log("getIpByExpressReq=remoteAddress=", req.socket.remoteAddress)
        let realIp = req.headers["X-Real-IP"];
        let ip = "";
        if (realIp) {
            if (typeof (realIp) == "string") {
                ip = realIp;
            }
        }
        ip = ip || req.socket.remoteAddress;
        if (ip && ip.indexOf('::ffff:') != -1) {
            ip = ip.substring(7);
        }
        // Logger.log("getIpByExpressReq=ip=", ip)
        return ip;
    }
}
exports.WebUtil = WebUtil;
